Minor: Make ProjectionExpr::new easier to use with constants#19343
Merged
alamb merged 3 commits intoapache:mainfrom Dec 17, 2025
Merged
Minor: Make ProjectionExpr::new easier to use with constants#19343alamb merged 3 commits intoapache:mainfrom
ProjectionExpr::new easier to use with constants#19343alamb merged 3 commits intoapache:mainfrom
Conversation
alamb
commented
Dec 15, 2025
| impl ProjectionExpr { | ||
| /// Create a new projection expression | ||
| pub fn new(expr: Arc<dyn PhysicalExpr>, alias: String) -> Self { | ||
| pub fn new(expr: Arc<dyn PhysicalExpr>, alias: impl Into<String>) -> Self { |
Contributor
Author
There was a problem hiding this comment.
this is the actual code change, the rest of the PR is cleaning up callsites
| let proj_expr = vec![ProjectionExpr::new( | ||
| Arc::new(Column::new_with_schema("value", &input_schema)?) as _, | ||
| "value".to_string(), | ||
| "value", |
Contributor
Author
There was a problem hiding this comment.
The underlying ProjectionExpr is still the same, this PR just makes it easier to make them
adriangb
approved these changes
Dec 15, 2025
martin-g
approved these changes
Dec 16, 2025
| @@ -484,7 +484,7 @@ fn test_memory_after_projection() -> Result<()> { | |||
| vec![ | |||
| ProjectionExpr::new(Arc::new(Column::new("d", 2)), "d".to_string()), | |||
| ProjectionExpr::new(Arc::new(Column::new("e", 3)), "e".to_string()), | |||
Member
There was a problem hiding this comment.
Why d and e are not simplified here ?
They look exactly the same as a
Contributor
Author
There was a problem hiding this comment.
That is an excellent catch -- done in 99edf9d
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
While reviewing the code from @pepijnve in #19287 I noticed it was a little awkward to create
ProjectionExprfrom constants. Let's add a nicer signature for that.Instead of
Do
What changes are included in this PR?
Are these changes tested?
By CI
Are there any user-facing changes?
A slightly nicer API